﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema
    targetNamespace="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"
    xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified">
    <xs:redefine schemaLocation="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas\ServiceDefinitionSchema.xsd">
        <xs:complexType name="ServiceDefinition">
            <xs:complexContent>
                <xs:extension base="ServiceDefinition">

                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
        <xs:complexType name="Site">
            <xs:complexContent>
                <xs:extension base="Site">
                    <xs:attribute name="applicationName" type="xs:string" />
                    <xs:attribute name="applicationVersion" type="xs:decimal" />
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:redefine>
    
    
    <!--<xs:complexType name="Site">
        <xs:complexContent>
            <xs:extension base="sd:Site">
                <xs:attributeGroup ref="ac:ApplicationTypeReference" />
                --><!--<xs:attribute name="applicationName" type="xs:string" />
                <xs:attribute name="applicationVersion" type="xs:string" />--><!--
            </xs:extension>
        </xs:complexContent>        
    </xs:complexType>
    <xs:complexType name="LocalResources">
        <xs:complexContent>
            <xs:extension base="sd:LocalResources">
                <xs:sequence>
                    <xs:element name="CloudDrives" type="ac:CloudDrives" minOccurs="0" maxOccurs="1" />
                </xs:sequence>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="VirtualDirectory">
        <xs:complexContent>
            <xs:extension base="sd:VirtualDirectory">
                <xs:attribute name="includePhysicalDirectoryFilesInPackage" type="xs:boolean" use="optional" default="true">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies whether the packaging process should include all files and folder
                            in the local physical directory in the solution package.

                            If true, all site files will be included in the solution package for upload
                            to Windows Azure.  This is the default Windows Azure behavior.

                            If false, no files will be included in the solutions package.

                            Set this value to false when using one or more of the Azure Accelerator
                            application deployment and maintainence solutions:

                            *  Cloud Drives
                            *  Source Control Delivery
                            *  Blob Synchronization (inter-role; on-presmise)
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="runtimeSolutionCopyBehaviour" use="optional" default="OnCloudDriveCreate">
                    <xs:annotation>
                        <xs:documentation>
                            This setting controls how the Accelerator handles files which have been included in
                            the solution package.  The default Windows Azure behavior is to redeploy the exact
                            solution package whenever the instance is restarted or redeployed. All changes made
                            to the running instance are rolled back (or ""healed"").
                            The Accelerator provides for using the files which are in the solution package in
                            a perdetermined set of optional ways.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:simpleType>
                        <xs:restriction base="xs:string">
                            <xs:enumeration value="OnCloudDriveCreate">
                                <xs:annotation>
                                    <xs:documentation>
                                        Copy the solutions files from the uploaded package only if this is the first
                                        time the solution has been initialized against a newly provisioned cloud drive.
                                        All subsequent deployments or reinitializations will use the files as they
                                        exist on the cloud drive and ignore those in the solution.
                                        Note:  This includes changed files if the solution is updated and redeployed.
                                        Use AllFiles if you wish to overwrite existing files with newly updated solutions
                                        files.
                                        If the runtime location is not set, this option is ignored, and the normal Windows
                                        Azure behavior of running from a read-only package location will be used.
                                        If the runtime location is set, but is not a cloud drive location, this option is
                                        ignored.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="Always">
                                <xs:annotation>
                                    <xs:documentation>
                                        Copy all files from the solution package to the runtime location. Overwrite existing
                                        files (on a cloud drive, for example). If the runtime location is not set, this is ignored.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="MissingFiles">
                                <xs:annotation>
                                    <xs:documentation>
                                        Copies only those solution files which do not exist in the runtime location.  All existing
                                        files and folders are ignored.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                            <xs:enumeration value="None">
                                <xs:annotation>
                                    <xs:documentation>
                                        No files copied.
                                        Solution files exist only as uploaded in the default deployed solution package location. This
                                        is the default behavior of Windows Azure packages.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:enumeration>
                        </xs:restriction>
                    </xs:simpleType>
                </xs:attribute>
                <xs:attribute name="runtimeLocalStorageLocation" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                            The physical directory location on Windows Azure where the virtual directory should point for the runtime
                            location.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="runtimeCloudSyncLocation" type="sd:VirtualDirectoryName" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                            The Windows Azure storage services location to use for synchronization of this physical directory with other
                            running cloud instances or with on-premise file changes.  This location should be unique across all separate customer
                            sites.
                            By default, this will inherit the location of its parent site or virtual directoy.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="runtimeCloudSyncConnectionStringSetting" type="xs:string" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                            The configuration setting name which has the credentials for connecting to Windows Azure storage.
                            Required when attempting to perform cloud based synchronization across instances.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>
    <xs:complexType name="CloudDrives">
        <xs:annotation>
            <xs:documentation>
                Details the list of cloud drives which should be mounted by the role.
            </xs:documentation>
        </xs:annotation>
        <xs:sequence maxOccurs="23" minOccurs="1">
            <xs:element name="CloudDrive" type="ac:CloudDrive" />
        </xs:sequence>
        <xs:attribute name="cacheLocalStorageSize" type="xs:int" use="required" >
            <xs:annotation>
                <xs:documentation>
                    The total amount of local storage to set aside for use in caching cloud drive content.
                    The cloud drive cache size is used by all cloud drives mounted in the instance.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="cacheLocalStorageName" type="xs:string" use="required">
            <xs:annotation>
                <xs:documentation>
                    The local storage resource name to use for the local cloud storage cache.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:complexType name="CloudDrive">
        <xs:attribute name="pathKey" type="sd:NamedElementNameString" use="required">
            <xs:annotation>
                <xs:documentation>
                    The local variable and system environment variable which will contain the drive path
                    of the mounted cloud drive (if successful).
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="connectionStringSetting" use="required">
            <xs:annotation>
                <xs:documentation>
                    The configuration setting name which contains the connection string for Windows Azure storage
                    services where the cloud drive resource is located.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="cloudDriveUri" type="sd:VirtualDirectoryName" use="required">
            <xs:annotation>
                <xs:documentation>
                    The Windows Azure storage services container and path to the cloud drive page blob (VHD).
                    This path must meet both the container name and path requirements of Windows Azure blob storage.
                    It is relative to the root of the storage service location.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="readOnly" type="xs:boolean" use="optional" default="true">
            <xs:annotation>
                <xs:documentation>
                    If true, the cloud drive will be mounted as read-only (if found).
                    If false, or not defined, the cloud drive will be mounted as writeable.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="createSizeOnNewInMB" type="xs:int" use="optional" default="1000">
            <xs:annotation>
                <xs:documentation>
                    If 0 (zero), no cloud drive will be created if it does not already exist.
                    Otherwise, a cloud drive will be created if one does not exist at the specified
                    location.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="cloneIfLocked" type="xs:boolean" use="optional" default="true">
            <xs:annotation>
                <xs:documentation>
                    If true, a writable copy (snapshot) of the cloud drive will be created and mounted by
                    this instance.
                    If false, the instance will fail if unable to successfully mount a writable version.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
    <xs:attributeGroup name="ApplicationTypeReference">
    <xs:attribute id="applicationName" name="applicationName" type="xs:string">
        <xs:annotation>
            <xs:documentation>
                The name of the Accelerator application definition from which to import standard
                application configuration settings for this site.

                Use the applicationVersion attribute to differentiate between definitions for
                applications with multiple different Azure Accelerator configurations.
            </xs:documentation>
        </xs:annotation>
    </xs:attribute>
    <xs:attribute id="applicationVersion" name="applicationVersion" type="xs:string" >
        <xs:annotation>
            <xs:documentation>
                Optional version attribute is used to differentiate between definitions for
                applications with multiple different Azure Accelerator configurations.

                This property is ignored unless more than one definition is found for the
                application specified in the applicationName property.
            </xs:documentation>
        </xs:annotation>
    </xs:attribute>
    </xs:attributeGroup>-->
</xs:schema>